package com.mingchuang.administrator.mingchuang.project;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.mingchuang.administrator.mingchuang.R;
import com.mingchuang.administrator.mingchuang.bean.ProjectBean;

import java.util.List;

/**
 * Created by kipeng on 2016-3-23.
 */
public class ProjectAdapter extends BaseAdapter {

    private List<ProjectBean> list;
    private LayoutInflater inflater = null;

    public ProjectAdapter(Context context, List<ProjectBean> list) {
        this.list = list;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ProjectBean pro = list.get(position);
        ViewHolder holder;
        if(convertView == null){
            convertView = inflater.inflate(R.layout.project_item,null);
            holder = new ViewHolder();
            holder.proName = (TextView) convertView.findViewById(R.id.pro_name);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        holder.proName.setText(pro.getName());

        //pro_name
        return convertView;
    }


    static class ViewHolder {
        TextView proName;


    }
}
